#!/usr/bin/env bash
# This is a demonstration script that resets the database, launches the
# server, opens the client interface, and finally launches the bot

echo "Starting demo !!"

yes yes | ./manage.py reset map track live testbot

./manage.py syncdb

./manage.py runserver &

# Wait for the server to initialize itself
sleep 1

open http://localhost:8000/live/

# Random walk algorithm
./testbot/bot.py -R -n50 -e0.001 -y -0.0005 -x -0.0001
# ./testbot/bot.py

echo "Ending demo."

# Find the server's pid ; kill it
ps aux | grep manage.py | grep -i python | cut -d' ' -f2 | xargs kill
